package com.wcar.store.controller;

import com.wcar.common.vo.Result;
import com.wcar.store.service.FrontUserService;
import com.wcar.store.until.SendCodeUtil;
import com.wcar.store.vo.AddUserVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Random;

/**
 * @BelongsProject: four-wcar-idea
 * @BelongsPackage: com.wcar.system.controller
 * @Author: 李睢康
 * @CreateTime: 2024-06-11  10:21
 */
@RestController
@RequestMapping("/store/register")
public class RegisterController {
    @Resource
    private FrontUserService frontUserService;
    @GetMapping("/api/selectPhone")
    public Result<String> findPhone(String phone){
        return frontUserService.selectPhone(phone);
    }
    @PostMapping("/api/sendSms")
    public Result<String> sendTxt(String phone){
        return frontUserService.sendTst(phone);
    }
    @GetMapping("/api/checkSms")
    public Result<String> repeat(String phone,String code){
        return frontUserService.repeat(phone,code);
    }
    @PostMapping("/api/registerFrontUser")
    public Result<String> addUser(@RequestBody AddUserVo addUserVo){
        return frontUserService.addUser(addUserVo);
    }
    @PutMapping("/updatePass")
    public Result<String> updatePass(@RequestBody AddUserVo addUserVo){
        return frontUserService.updatePass(addUserVo);
    }
}
